﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bowerbird.Core.Services;
using Bowerbird.Core.Dtos;

namespace Bowerbird.Website.Controllers
{
    public class ApiController : Controller
    {
        public JsonResult LogIn(string identityProvider, string nameIdentifier, string name)
        {
            try
            {
                UserService service = new UserService();

                UserDto user = service.LogIn(identityProvider, nameIdentifier, name);

                return Json(user);
            }
            catch (Exception ex)
            {
                throw ex; // Todo: wrap the exception inside an ApiResponse
            }
        }
    }
}
